export default {
    namespaced: true,
    state: {
        //控制是否显示提示框
        isShow: false,
        toastMsg: "默认提示内容。。。",
        //提示图标
        toastType: "success"
    },
    mutations: {
        changeisShowToast(state, payload) {
            state.isShow = payload.isShow
            //修改isShow,toastMsg,toastType
            if (payload.isShow) {
                state.toastMsg = payload.toastMsg
                state.toastType = payload.toastType
            }

        }
    },
    actions: {
        //异步代码
        asyucisShowToast({ commit }, payload) {
            commit("changeisShowToast", payload)
            setTimeout(() => {
                commit("changeisShowToast", {
                    isShow:false
                })
            }, 2000);
        }
    }
}